<?php 

namespace app\admin\controller;

use think\Db;

class Order extends Base
{
	protected $datas;

	/**
	 * 订单列表
	 * @Author   Yichen
	 * @DateTime 2020-05-04T11:30:05+0800
	 * @return   [type]                   [description]
	 */
	public function orderList()
	{
		$list = Db::name('t_order')->alias('o')
			->join('t_user u', 'u.id=o.user_id', 'left')
			->join('t_goods_property gp','o.goods_property_id=gp.id', 'left')
			->join('t_goods g', 'g.id=gp.goods_id', 'left')
			->field('o.id,o.order_no,u.username,g.name,o.goods_price,o.number,o.pay_price,o.pay_time,o.outer_trade_no,o.pay_status,o.trade_status,o.address,o.remark,o.create_time,o.goods_property_id')
			->select();
		$this->assign('list', $list);
		return $this->fetch();
	}

	/**
	 * 订单详情
	 * @Author   Yichen
	 * @DateTime 2020-05-10T21:34:45+0800
	 * @return   [type]                   [description]
	 */
	public function orderProperty()
	{
		$this->datas = $this->params;
		$id = $this->datas['id'];
		$data = Db::name('t_order_item')->where('order_id', $id)->select();
		$this->assign('list', $data);
		return $this->fetch();
	}
}